package br.edu.fatecou.reserva.util;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class HibernateUtil {

	private static SessionFactory sessionFactory;

	@SuppressWarnings("deprecation")
	private static SessionFactory buildSessionFactory() throws Exception {
		return new Configuration().configure().buildSessionFactory();
	}

	public static SessionFactory getSessionFactory() throws Exception {
		if (sessionFactory == null) {
			sessionFactory = buildSessionFactory();
		}
		return sessionFactory;
	}
}
